import type {IColumnsOption} from 'vc';
import {
  INDEX,
} from '@/utils/tableColumn';

export function useTable(data) {
  const columns = ref<IColumnsOption[]>([
    {...INDEX},
    {
      field: 'licenceNo',
      title: '排污许可证编号',
      align: 'center',
      sortable: true,
      width: 200,
      sortBy: 'licenceNo',
    },
    {
      field: 'beginTime',
      title: '超标起始日期',
      align: 'center',
      width: 150,
      sortable: true,
      sortBy: 'beginTime'
    },
    {
      field: 'expireTime',
      title: '超标截止日期',
      align: 'center',
      sortable: true,
      width: 150,
      sortBy: 'expireTime',
    },
    {
      field: 'faultFacilities',
      title: '故障设施',
      width: 150,
      showOverflow: 'title'
    },
    {
      field: 'reason',
      title: '故障原因',
      width: 150,
      showOverflow: 'title'
    },
    {
      field: 'pollutionFactors',
      title: '污染因子',
      align: 'center',
      width: 120,
    },
    {
      field: 'concentration',
      title: '污染因子浓度',
      align: 'center',
      width: 120,
      slots: {
        default: ({row}) => {
          return <>
            <div class="date">
              <span class="text">{row.concentration}{row.unit}</span>
            </div>
          </>;
        }
      }
    },
    {
      field: 'solutions',
      title: '应对措施',
      width: 150,
      showOverflow: 'title'
    },


  ]);

  return {
    columns
  };
}
